Display object properties

The properties of an object can be displayed as a string:

The properties of an object can be collected in a loop:

Using Object.values()

Object.values() converts an object to an array.

Using JSON.stringify()

JSON.stringify() is included in JavaScript and supported in all major browsers.Any JavaScript object can be stringified (converted to a string) with the JavaScript function JSON.stringify():

Display properties in JSON format:

the JSON notation: {"name":"John","age":50,"city":"New York"}